<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>阅读题目</title>
<style>
.cl{width:95%; margin:60px auto;}
.ans{ width:1200px; margin:60px auto;}
</style>
    <script src="/cn/js/jquery-1.12.2.min.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<!-- 编辑器公式插件 -->
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/getKfContent.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/defaultFilterFix.js"></script>
</head>
<body>

<div id="wrapper" class="cl">
    <div style="margin-bottom: 10px">
        开始题号<input class="num" type="text">
    </div>
    <form action="">
        <div class="controls">
            <textarea style="width: 800px;height: 300px;" id="content"></textarea>
        </div>
        <button type="button" class="update">拖拽题生成</button>
        <div class="controls">
            <p>拖拽题题目</p>
            <textarea style="width: 800px;height: 300px;" id="content2"></textarea>
            <div>
    </form>
</div>


<script type="text/plain" id="j_ueditorupload"></script>
</body>
</html>

<script>

    $('.update').click(function () {
        var content = $('#content').val();
        var arr = content.split(/[(\r\n)\r\n]+/);
        var num = $('.num').val();
        if($.trim(num)==''){
            alert('请填写开始题号');
            return false;
        }
        arr.forEach((item, index) => { // 删除空项
            var nums = Number(index)+Number(num);
            var con = item+'<span class="answer-fill">'+nums+'</span>';
            arr[index] = con;
        })
        var str = arr.join("\n");
        $('#content2').val(str)
    })

</script>




